home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / postscript / faq.part7-10 < prev    next >
Encoding:
Text File  |  1995-07-25  |  34.6 KB  |  952 lines

  1. Subject: PostScript monthly FAQ v2.3 07-07-94 [07-10 of 11]
  2. Newsgroups: comp.lang.postscript,comp.answers,news.answers
  3. From: Jonathan Monsarrat <postscript-request@cs.brown.edu>
  4. Date: Mon, 7 Nov 1994 20:05:34 GMT
  5.  
  6. Archive-name: postscript/faq/part7-10
  7. Last-modified: 1993/07/07
  8. Version: 2.3
  9.  
  10.                               -- PostScript -- 
  11.  
  12.                             Answers to Questions 
  13.  
  14.                     (the comp.lang.postscript FAQ v2.3) 
  15.  
  16.                                Jon Monsarrat 
  17.  
  18.                               jgm@cs.brown.edu 
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.                      This FAQ is formatted as a digest. 
  26.  
  27.                 Most news readers can skip from one question 
  28.  
  29.                 to the next by pressing control-G. GNUs uses 
  30.  
  31.                    C-c C-n to skip to the next question. 
  32.  
  33.  
  34.     Changes since the last version are marked with a '|' in the table 
  35.     of contents and in the sections in the text-only format of the FAQ. 
  36.  
  37.     Now that there is Linux and NetBSD and BSD 386 UNIX IBM PC (and 
  38.     clone) users can run any of the X-windows and UNIX programs in the 
  39.     utilities section. See any of comp.os.linux.{ 
  40.     admin,development,help,misc}. Also, there is now GhostScript for 
  41.     the Macintosh. 
  42.  
  43.     Many thanks to Dan Carrigan for reformatting the books and 
  44.     publishers section. 
  45.  
  46.     The utilities index from the comp.sources.postscript FAQ will be 
  47.     posted in comp.lang.postscript now too. 
  48.  
  49.     Please help fix the FAQ! All comments should be mailed to 
  50.     jgm@cs.brown.edu. My favorite way to receive a change suggestion is 
  51.     when it is accompanied by a section of the FAQ that is edited and 
  52.     mailed to me verbatim as an example. If you would like to 
  53.     contribute, please read the section ``about the FAQ'' first. Thank 
  54.     you! 
  55.  
  56.     Books and programs are referred to by name only. See the book 
  57.     sections for book information, and the comp.sources.postscript FAQ 
  58.     for a full list of all PostScript related programs. I have archived 
  59.     a number of the small utilities in 
  60.     wilma.cs.brown.edu:pub/postscript. You can get the 
  61.     comp.sources.postscript FAQ from 
  62.     wilma.cs.brown.edu:pub/comp.sources.postscript. 
  63.  
  64.     Related FAQs: comp.text, comp.text.tex, comp.fonts, comp.graphics, 
  65.     comp.sys.mac.apps, comp.sources.postscript. 
  66.  
  67.  
  68. ------------------------------
  69.  
  70. Subject: 7 Programming in PostScript 
  71.  
  72.  
  73. ------------------------------
  74.  
  75. Subject: 7.1 What is PostScript level 2? 
  76.  
  77.     (See the Section 11, ``About PostScript 2''.) 
  78.  
  79.  
  80. ------------------------------
  81.  
  82. Subject: 7.2 Should I learn level 2 PostScript? 
  83.  
  84.     Yes, because Level Two will soon become the standard. Application 
  85.     developers using PostScript need to become aware of the new 
  86.     capabilities and how to take advantage of them. 
  87.  
  88.     There are many good books on PostScript 2. (See Section 5, 
  89.     ``Books''.) 
  90.  
  91.  
  92. ------------------------------
  93.  
  94. Subject: 7.3 Where can I find examples of PostScript code? 
  95.  
  96.     Many other books on PostScript make example PostScript code 
  97.     available. ``Thinking in PostScript'', by Glenn Reid, is the only 
  98.     book I know of that allows its examples to be freely distributed. 
  99.     (See Section 5, ``Books''.) 
  100.  
  101.     All the examples in ``the blue book'' are available from the Adobe 
  102.     file server (See Section 5, ``Books''.) 
  103.  
  104.     See the question ``How can I browse through PostScript programs?'' 
  105.     in the comp.sources.postscript FAQ. 
  106.  
  107.  
  108. ------------------------------
  109.  
  110. Subject: 7.4 What is the physical size of the page? 
  111.  
  112.     This depends on what print medium you are using. Paper comes in a 
  113.     number of standard sizes: 
  114.  
  115.   
  116.           Paper Size                      Dimension (in points)
  117.           ------------------------------  ---------------------
  118.           Comm #10 Envelope               297 x 684
  119.           C5 Envelope                     461 x 648
  120.           DL Envelope                     312 x 624
  121.           Folio                           595 x 935
  122.           Executive                       522 x 756
  123.           Letter                          612 x 792
  124.           Legal                           612 x 1008
  125.           Ledger                          1224 x 792
  126.           Tabloid                         792 x 1224
  127.           A0                              2384 x 3370
  128.           A1                              1684 x 2384
  129.           A2                              1191 x 1684
  130.           A3                              842 x 1191
  131.           A4                              595 x 842
  132.           A5                              420 x 595
  133.           A6                              297 x 420
  134.           A7                              210 x 297
  135.           A8                              148 x 210
  136.           A9                              105 x 148
  137.           B0                              2920 x 4127
  138.           B1                              2064 x 2920
  139.           B2                              1460 x 2064
  140.           B3                              1032 x 1460
  141.           B4                              729 x 1032
  142.           B5                              516 x 729
  143.           B6                              363 x 516
  144.           B7                              258 x 363
  145.           B8                              181 x 258
  146.           B9                              127 x 181 
  147.           B10                             91 x 127
  148.   
  149.     To determine what print mediums are available, check the PPD file 
  150.     for your printer, under the PageSize keyword. 
  151.  
  152.  
  153. ------------------------------
  154.  
  155. Subject: 7.5 What is the Imagable Area of the page 
  156.  
  157.     The initial clipping path gives you the size of the imagable area. 
  158.     Use ``clippath pathbbox'' to get these coordinates. If you must 
  159.     know the size of the device's imageable area, use the sequence 
  160.     ``gsave initclip clippath pathbbox grestore'', but this will 
  161.     prevent an enclosing application from using the clippath to achieve 
  162.     some special effects (such as multiple pages per page). 
  163.  
  164.     PPD files (see section 2 of the FAQ, printers) contain information 
  165.     on what paper sizes, as well as the Imagable Area for each, 
  166.     specific to each printer. A Postscript code fragment (called 
  167.     ``?ImageableArea'') is described in a PPD file, which determines 
  168.     the current Imageable Area for that printer. 
  169.  
  170.  
  171. ------------------------------
  172.  
  173. Subject: 7.6 Why can't I do a pathforall after a charpath ? 
  174.  
  175.     (See Section 4, ``Fonts'', question ``Why are Adobe fonts 
  176.     hidden?''.) 
  177.  
  178.  
  179. ------------------------------
  180.  
  181. Subject: 7.7 How do I center a string of text around a point? 
  182.  
  183.     Level 1 PostScript has two operators that can extract information 
  184.     about the metrics of characters: ``stringwidth'' and ``charpath''. 
  185.  
  186.     The ``stringwidth'' operator returns the advance width of its 
  187.     string operand. This is the distance the current point would be 
  188.     moved by a ``show'' operation on the same string. ``stringwidth'' 
  189.     returns two numbers on the stack, representing the x and y 
  190.     components of the advance width. Usually the y component is zero 
  191.     because most fonts are displayed along a horizontal line, moving 
  192.     the current point only in the x direction. 
  193.  
  194.     Also note that the ``stringwidth'' usually does not give an exact 
  195.     measure of the area of the page that will be touched by its 
  196.     operand. The letters can either project a little over the 
  197.     boundaries or fall a little within (leaving a touch of whitespace). 
  198.  
  199.     If all that an application requires is horizontal centering of a 
  200.     long string of text, the result returned by ``stringwidth'' is 
  201.     sufficient. A common technique is 
  202.  
  203.   
  204.           x y moveto
  205.           (string) dup stringwidth pop 2 div neg 0 rmoveto show
  206.   
  207.     (This code makes the assumption that the y component of advance 
  208.     width is irrelevant.) 
  209.  
  210.     The ``charpath'' operator extracts the graphic shapes of its string 
  211.     operand and appends them to the current path in the graphic state. 
  212.     These shapes can then be processed by other PostScript operators. 
  213.     To get the actual size of the area touched by a character a simple 
  214.     approach is 
  215.  
  216.   
  217.           gsave
  218.           newpath
  219.           0 0 moveto
  220.           (X) false charpath flattenpath pathbbox
  221.           grestore
  222.   
  223.     This code places four numbers on the stack, representing the 
  224.     coordinates of the lower left and upper right corners of the 
  225.     bounding box enclosing the character ``X'' rendered with the 
  226.     current point at (0,0). Leaving the flattenpath out will cause it 
  227.     to be less accurate, but it will take up less memory and be faster. 
  228.  
  229.     There are two things to be careful about when using the code shown 
  230.     above: 
  231.  
  232.  
  233.  
  234.    1. There are severe limits on the size of the string operand, 
  235.       related to the limit on the number of elements in a graphic path. 
  236.       The PostScript Language Reference Manual recommends taking 
  237.       ``charpath''s one character at a time. 
  238.  
  239.  
  240.    2. If user space is rotated or skewed with respect to device space, 
  241.       the result from ``pathbbox'' may be larger than expected; 
  242.       ``pathbbox'' returns a rectangle oriented along the user space 
  243.       coordinate axes, which fully encloses a (possibly smaller) 
  244.       rectangle oriented along the coordinate axes of device space. If 
  245.       user space is rotated at an integer multiple of 90 degrees these 
  246.       two rectangles will be the same, otherwise the rectangle in user 
  247.       space will be larger. 
  248.  
  249.     So, to center text vertically one must get the bounding boxes of 
  250.     all the characters in the string to be displayed, find the minimum 
  251.     and maximum y coordinate values, and use half the distance between 
  252.     them to displace the text vertically. This still may not do a very 
  253.     good job, since this provides centering based on extrema, not on 
  254.     the optical center of the string (which is more related to a sort 
  255.     of ``center of mass'' of the text). 
  256.  
  257.     If an application does this repeatedly, it would be wise to store 
  258.     the bounding boxes in an array indexed by character code, since 
  259.     ``charpath'' is a slow operation. 
  260.  
  261.     Font metric information is available outside of a PostScript 
  262.     printer in font metrics files, available from the font vendor. A 
  263.     program generating PostScript output can obtain metrics from these 
  264.     files rather than extracting the metrics in the printer. 
  265.  
  266.  
  267. ------------------------------
  268.  
  269. Subject: 7.8 How can I concatenate two strings together? 
  270.  
  271.   
  272.   %% string1 string2 append string
  273.   % Function: Concatenates two strings together.
  274.   /append {
  275.            2 copy length exch length add  % find the length of the new.
  276.            string dup     % string1 string2 string string
  277.            4 2 roll       % string string string1 string2
  278.            2 index 0 3 index
  279.            % string string string1 string2 string 0 string1
  280.            putinterval    % stuff the first string in.
  281.            % string string string1 string2
  282.            exch length exch putinterval
  283.   } bind def
  284.   
  285.  
  286. ------------------------------
  287.  
  288. Subject: 7.9 What do I do when I get stack overflow/underflow? 
  289.  
  290.     These errors are among the most common in PostScript. 
  291.  
  292.     When I get a stack overflow, that is usually a sign that a routine 
  293.     is leaving an object on the stack. If this routine gets called 2000 
  294.     times, it leaves 2000 objects on the stack, which is too many. 
  295.  
  296.     When I get a stack underflow, that is a sign that either: (A) one 
  297.     of the routines in the program doesn't work, and never has or (B) 
  298.     one of the routines in the program works, but expects to be called 
  299.     with some arguments left on the stack. 
  300.  
  301.     There is no such thing as a PostScript debugger right now. For now, 
  302.     the best that you can do to debug your program is to put in lots of 
  303.     print statements. Learn to use the PostScript pstack command, and 
  304.     use an online interpreter so you don't have to run to the printer 
  305.     for each debugging cycle. 
  306.  
  307.     Use an error handler to learn more about what exactly is happening 
  308.     when your program crashes. (see the comp.sources.postscript FAQ for 
  309.     a list of all PostScript related programs.) 
  310.  
  311.     If your code has never worked yet (i.e. you are still writing it) 
  312.     then I find that it helps to put little comments in the margin 
  313.     about the state of the stack. Like this: 
  314.  
  315.   
  316.          Heart pathbbox             % lowerx lowery upperx uppery
  317.          exch 4 -1 roll             % lowery uppery upperx lowerx
  318.   
  319.   
  320.     I generally put these comments in originally, and then take them 
  321.     out when the program works. Maybe this is a bad practice, in case I 
  322.     ever want to go back and look at the code to modify it!! 
  323.  
  324.  
  325. ------------------------------
  326.  
  327. Subject: 7.10 How can I print in landscape mode? 
  328.  
  329.     Landscape (the opposite of portrait) means that the page is turned 
  330.     on its side. You can redefine showpage in terms of the current 
  331.     definition of showpage. 
  332.  
  333.     Do something like: 
  334.  
  335.   
  336.   /oldshowpage /showpage load def
  337.   
  338.   90 rotate llx neg ury neg translate   % for the first page
  339.   /showpage
  340.   {
  341.           oldshowpage
  342.           90 rotate llx neg ury neg translate
  343.   } def
  344.   
  345.     This won't work if the PostScript file you're editing uses 
  346.     initgraphics or grestoreall. Also note that the method described 
  347.     (redefining showpage) does not conform to the document structuring 
  348.     conventions. The Adobe recommended method involves performing the 
  349.     transformaton as part of the setup for each page. 
  350.  
  351.  
  352. ------------------------------
  353.  
  354. Subject: 8 Computer-specific PostScript 
  355.  
  356.     This section describes PostScript information specific to a 
  357.     particular type of computer or operating system. 
  358.  
  359.  
  360. ------------------------------
  361.  
  362. Subject: 8.1 Sun Workstations 
  363.  
  364.     What is NeWS? 
  365.  
  366.     NeWS (R.I.P.) was Sun Microsystems PostScript-based window system 
  367.     for the Sun Workstation. NeWS was a project within Sun (started 
  368.     around 1985) to create a window system to supplant SunView (a very 
  369.     successful kernel-based window system). NeWS was a client-server 
  370.     model window system (like X) but among many of NeWS novel features 
  371.     was the use of PostScript as the language to describe the 
  372.     appearance of objects on the screen. NeWS had many features in 
  373.     common with Display PostScript, but NeWS predates Adobe Display 
  374.     PostScript and was neither connected with Adobe Display PostScript 
  375.     nor endorsed by Adobe. NeWS was not an Adobe product, nor was it a 
  376.     Sun/Adobe joint venture. 
  377.  
  378.     As of October 1992, Sun management signed a deal with Adobe to 
  379.     adopt Display PostScript for the Sun. In 1993, Sun finally dropped 
  380.     NeWS altogether. The Sun window system is supposed to start 
  381.     shipping a Display PostScript environment in late 1993. 
  382.  
  383.     And how does PostScript run on them? 
  384.  
  385.     PostScript runs on NeWS, although NeWS was not a fully-compliant 
  386.     PostScript interpreter. There were incompatibilities between the 
  387.     NeWS PostScript interpreter and ``official'' PostScript 
  388.     interpreters as defined by Adobe and the Apple LaserWriter family 
  389.     of printers, such that many PostScript files which would print fine 
  390.     on a LaserWriter would not render under NeWS. The most critical 
  391.     incompatibility was lack of support for Adobe Type 1 fonts, Sun 
  392.     having gone with their own font format known as F3. F3 fonts have 
  393.     now gone the way of the zumbooruk and will be supplanted by Type 1 
  394.     fonts. 
  395.  
  396.  
  397. ------------------------------
  398.  
  399. Subject: 8.2 IBM PC 
  400.  
  401.     You can find nenscript for OS/2 1.x--2.0 and MSDOS on 
  402.     ftp-os2.nmsu.edu in pub/uploads/nensc113.zip. 
  403.  
  404.     Microsoft Word for Windows can produce files with incorrect DSC 
  405.     comments. To fix this, from the Control Panel, select Printers, 
  406.     Options..., Advanced, and then check 'Conform to Adobe Document 
  407.     Structuring conventions'. This is not enough to produce a valid DSC 
  408.     document - you also need to remove the leading Ctrl-D as documented 
  409.     in PRINTERS.WRI. 
  410.  
  411.     There are rumors that Word Perfect and Microsoft Word don't produce 
  412.     ``clean'' PostScript that follows the DSC conventions (See Section 
  413.     9, ``Encapsulated PostScript''). This means that a lot of 
  414.     PostScript utilities like Ghostview and psnup, etc., that require 
  415.     the DSC conventions, will not work on them. 
  416.  
  417.     Creating a PostScript file from MS Word 
  418.  
  419.     Install the LaserWriter driver that comes with Windows.In the 
  420.     printer setup, select a PostScript printer. Then click on the setup 
  421.     button to get that pop-up. Then clik the Options button. Then 
  422.     select the print to Encapsulated PostScript File. If you don't 
  423.     specify a file name, Word will prompt you for one when you tell it 
  424.     to print. 
  425.  
  426.     When printing Microsoft Windows files that have been captured on a 
  427.     PC's LPT port, you mostly need to define two ctrl-d's in a row as 
  428.     well to remove all of them in the document: 
  429.  
  430.   
  431.   (\004\004) cvn {} def
  432.   
  433.  
  434. ------------------------------
  435.  
  436. Subject: 8.3 Apple Macintosh 
  437.  
  438.     For more details about printing with the Macintosh, read the 
  439.     comp.sys.mac.apps FAQ. 
  440.  
  441.     How can I convert a PostScript file created with a UNIX program to 
  442.     the Mac? 
  443.  
  444.     A way that is clumsy, but works, is this: 
  445.  
  446.  
  447.  
  448.    1. Display the UNIX-based PostScript file on screen 
  449.  
  450.  
  451.    2. Use window dumping facility to get a bitmap file 
  452.  
  453.  
  454.    3. Convert the above bitmap file to TIFF format and then export it 
  455.       to Adobe Illustrator on the Mac. 
  456.  
  457.     The PostScript section of the FAQ for the Macintosh newsgroup 
  458.     comp.sys.mac.apps (maintained by Elliotte Harold) answers the 
  459.     following questions: 
  460.  
  461.  
  462.  
  463.     * How do I make a PostScript file? 
  464.  
  465.  
  466.     * How do I print a PostScript file? 
  467.  
  468.  
  469.     * Why won't my PostScript file print on my mainframe's printer? 
  470.  
  471.       Full documentation of this process provided with a utility called 
  472.       macps. 
  473.  
  474.  
  475.     * Why are my PostScript files so big? 
  476.  
  477.  
  478. ------------------------------
  479.  
  480. Subject: 9 Encapsulated PostScript 
  481.  
  482.  
  483. ------------------------------
  484.  
  485. Subject: 9.1 What is Encapsulated PostScript? 
  486.  
  487.     Encapsulated PostScript (EPS) is a standard format for importing 
  488.     and exporting PostScript language files in all environments. It is 
  489.     usually a single page PostScript language program that describes an 
  490.     illustration. The purpose of the EPS file is to be included as an 
  491.     illustration in other PostScript language page descriptions. The 
  492.     EPS file can contain any combination of text, graphics, and images. 
  493.     An EPS file is the same as any other PostScript language page 
  494.     description, with some restrictions. 
  495.  
  496.     EPS files can optionally contain a bitmapped image preview, so that 
  497.     systems that can't render PostScript directly can at least display 
  498.     a crude representation of what the graphic will look like. There 
  499.     are three preview formats: Mac (PICT), IBM (tiff), and a platform 
  500.     independent preview called EPSI. 
  501.  
  502.     An EPS file must be a conforming file, that is, it must conform to 
  503.     the Adobe Document Structuring Conventions (DSC). At a minimum, it 
  504.     must include a header comment,%!PS-Adobe-3.0 EPSF-3.0, and a 
  505.     bounding box comment,%%BoundingBox: llx lly urx ury, that 
  506.     describes the bounds of the illustration. 
  507.  
  508.     (The specification does not require the EPSF version, but many 
  509.     programs will reject a file that does not have it.) 
  510.  
  511.     The EPS program must not use operators that initialize or 
  512.     permanently change the state of the machine in a manner that cannot 
  513.     be undone by the enclosing application's use of save and restore 
  514.     (eg. the operators starting with ``init'' like initgraphics). As a 
  515.     special case, the EPS program may use the showpage operator. The 
  516.     importing application is responsible for disabling the normal 
  517.     effects of showpage. 
  518.  
  519.     The EPS program should make no environment-sensitive decisions (the 
  520.     importing application may be trying to attain some special effect, 
  521.     and the EPS program shouldn't screw this up), although it can use 
  522.     some device-dependent tricks to improve appearance such as a 
  523.     snap-to-pixel algorithm. 
  524.  
  525.     The complete EPS specification is available from Adobe (see the 
  526.     section on Adobe). Read Appendix G (Document Structuring 
  527.     Conventions, V3.0) and Appendix H (Encapsulated PostScript File 
  528.     Format, V3.0) in the new PostScript red book: PostScript Language 
  529.     Reference Manual, Second Edition. 
  530.  
  531.     An optional component of an EPS file is a ``preview'' image of the 
  532.     file's content. The preview image is a bitmapped representation of 
  533.     the image which may be displayed by programs using the EPS file 
  534.     without having to actually interpret the PostScript code. 
  535.  
  536.     The recommended form for a preview image is ``Interchange'' format 
  537.     and is described fully in the ``red book'', second edition. 
  538.     Interchange format represents the image as a series of hex strings 
  539.     placed in the EPS file as PostScript comments. The entire file 
  540.     remains an ASCII file. 
  541.  
  542.     That book contains all of the information that you need to fix your 
  543.     program to correctly output EPS. It is what I use for our software. 
  544.  
  545.     A variation of EPS embeds the preview image and PostScript text in 
  546.     a binary file which contains a header and the preview image in 
  547.     either a TIFF or MetaFile format. The header defines where in the 
  548.     file each section (EPS, TIFF, or MetaFile) starts and ends. On the 
  549.     Macintosh, the preview is stored as a PICT in the file's resource 
  550.     fork. 
  551.  
  552.  
  553. ------------------------------
  554.  
  555. Subject: 9.2 What are EPSI and EPSF? 
  556.  
  557.     EPSI is EPS with a device independent bitmap preview. EPSI is an 
  558.     all ASCII (no binary data or headers) version of EPS. EPSI provides 
  559.     for a hexadecimal encoded preview representation of the image that 
  560.     will be displayed or printed. EPSI files were documented by Adobe 
  561.     as a means of providing a preview for EPS files which would be 
  562.     cross-platform. In reality though DOS machines and Windows favour 
  563.     embedding TIFF or even Windows Metafiles in the PostScript. I don't 
  564.     know of any Mac packages that support EPSI files. 
  565.  
  566.     The Macintosh has always favoured EPSF files with the data fork of 
  567.     the file containing the PostScript code, and the resource fork 
  568.     containing a PICT preview of the file. This is how typically when 
  569.     you import an EPSF file into a program (Quark, Persuasion etc.) you 
  570.     get to see the PICT preview from the file. It is still possible to 
  571.     have an EPSF file without a preview though, in this case the 
  572.     imported artwork is displayed usually as a box with diagonal lines 
  573.     running through it. Note the term EPSF really means that the image 
  574.     is independant of an output device, in other words the image would 
  575.     need to be embedded inside other PostScript code to be usable 
  576.     (printable). The old command-lk files from the PS driver on the Mac 
  577.     are not EPSF files as they are produced for a specific output 
  578.     device (LaserWriter). Therefore they cannot be imported into other 
  579.     applications for printing. ESPF must be given resource number 256. 
  580.  
  581.  
  582. ------------------------------
  583.  
  584. Subject: 9.3 How do I convert PostScript to EPS? 
  585.  
  586.     Use pstoepsi, or do it by hand. GhostScript's program ps2epsi does 
  587.     this also, as does LaserWriter 8 for the Mac. GhostScript on the 
  588.     Mac can output EPS also, I believe. 
  589.  
  590.     To convert from PostScript to EPS, one must guarantee that the 
  591.     PostScript file meets the above requirements. If the actual program 
  592.     conforms to the programming requirements, then one can simply add 
  593.     the required comments at the top of the file saying that the file 
  594.     is EPS and giving its BoundingBox dimensions. 
  595.  
  596.     Optional comments include font usage (%%DocumentFonts: or%% 
  597.     DocumentNeededResources: font), EPSI preview comments (%% 
  598.     Begin(End)Preview:) extensions (%%Extensions:) and language 
  599.     level (%%LanguageLevel:). 
  600.  
  601.     There are some operators that should not be used within an EPS 
  602.     file: 
  603.  
  604.   
  605.           banddevice     cleardictstack   copypage     erasepage
  606.           exitserver     framedevice      grestoreall  initclip
  607.           initgraphics   initmatrix       quit         renderbands
  608.           setglobal      setpagedevice    setshared    startjob
  609.   
  610.     These also include operators from statusdict and userdict operators 
  611.     like legal, letter, a4, b5, etc. 
  612.  
  613.     There are some operators that should be carefully used: 
  614.   
  615.           nulldevice     setgstate        sethalftone  setmatrix
  616.           setscreen      settransfer      undefinefont
  617.   
  618.     To convert a PostScript file to EPS format, you must edit the file 
  619.     using a text editor or word processor to add lines that will define 
  620.     the file as an EPS-format file. 
  621.  
  622.  
  623.  
  624.    1. Using your normal method of printing, print the PostScript file 
  625.       to a PostScript printer. You can choose to view it on the screen 
  626.       instead, but keep in mind that all the below distance 
  627.       measurements assume that you are printing on a normal-sized piece 
  628.       of paper. 
  629.  
  630.       NOTE: If the PostScript image does not get displayed properly, it 
  631.       probably will not work either once you have converted it to EPS 
  632.       format. Correct the PostScript program so that it works before 
  633.       you convert it to EPS format. 
  634.  
  635.  
  636.    2. Use a tool (see below) to find the bounding box, which shows how 
  637.       much space the PostScript image occupies when printed. You 
  638.       specify the dimensions of the bounding box when you convert the 
  639.       PostScript file to EPS format. 
  640.  
  641.  
  642.    3. If you don't have a bounding box tool, you can just use a ruler 
  643.       and draw one on your printout. With two horizontal lines and two 
  644.       vertical lines, draw a box around the image that includes the 
  645.       entire image while minimizing white space. 
  646.  
  647.       This box represents your bounding box. You may want to leave a 
  648.       small amount of white space around the image as a precautionary 
  649.       measure against minor printing problems, such as paper stretching 
  650.       and paper skewing. 
  651.  
  652.  
  653.    4. Measure distance ``a'' from the lower-left corner of the image to 
  654.       the left edge of the paper. 
  655.  
  656.  
  657.    5. Write the measurement in points. If your ruler does not show 
  658.       points, calculate the total number of points: 1 inch = 72 points, 
  659.       1 cm = 28.3 points, and 1 pica = 12 points. Designate this 
  660.       measurement as ``measurement a.'' 
  661.  
  662.  
  663.    6. Measure distance ``b'' from the lower-left corner of the image to 
  664.       the bottom edge of the paper. 
  665.  
  666.       Designate this measurement in points as ``measurement b.'' 
  667.  
  668.  
  669.    7. Measure distance ``c'' from the upper-right corner of the image 
  670.       to the left edge of the paper. 
  671.  
  672.       Designate this measurement in points as ``measurement c.'' 
  673.  
  674.  
  675.    8. Measure distance ``d' from the upper-right corner of the image to 
  676.       the bottom edge of the paper. 
  677.  
  678.       Designate this measurement in points as ``measurement d.'' 
  679.  
  680.  
  681.    9. Using any text editor, open the PostScript file for editing. 
  682.  
  683.       You'll see several lines of text. These lines are the PostScript 
  684.       description of the image. The lines at the top of the file are 
  685.       the header. 
  686.  
  687.  
  688.   10. Add these lines to, or modify existing lines in, the header (the 
  689.       first group of lines in any PostScript file): 
  690.  
  691.     
  692.             %!PS-Adobe-2.0 EPSF-2.0
  693.             %%Creator: name
  694.             %%CreationDate: date
  695.             %%Title: filename
  696.             %%BoundingBox: a b c d
  697.     
  698.  
  699.       Note: Make sure that the first line in the file is ``% 
  700.       !PS-Adobe-2.0-EPSF-2.0''. Also, do not separate the header lines 
  701.       with a blank line space. The first blank line that PostScript 
  702.       encounters tells it that the the next line begins the body of the 
  703.       program. 
  704.  
  705.       For ``name,'' type your name or initials. For ``date,'' type 
  706.       today's date using any format (for example, MM-DD-YY, MM/DD/YY, 
  707.       July 5, 1987, and so on). For ``filename,'' type the name of the 
  708.       PostScript file. After ``BoundingBox: ,'' type the measurements 
  709.       you took in steps 3, 4, 5, and 6, separating each with a space: 
  710.       ``a'' is the measurement from Step 3, ``b'' is the measurement 
  711.       from Step 4, ``c'' is the measurement from Step 5, and ``d'' is 
  712.       the measurement from Step 6. 
  713.  
  714.  
  715.   11. Save the file in text-only format. 
  716.  
  717.     If you are interested in learning how to further edit your 
  718.     PostScript files, these books are available at most bookstores: 
  719.  
  720.     Understanding PostScript Programming and the green book. 
  721.  
  722.     The Document Structuring Conventions (DSC), version 1.0, are 
  723.     discussed in Appendix C of the old red book. The new red book has a 
  724.     lot of information about Encapsulated PostScript. 
  725.  
  726.     There will be a technical note available from Adobe called 
  727.     ``Guidelines for Specific Operators'' that will talk about why some 
  728.     operators are prohibited and how to use the others. 
  729.  
  730.  
  731. ------------------------------
  732.  
  733. Subject: 9.4 How do I get the bounding box of a PostScript picture? 
  734.  
  735.     Use bbfig or epsinfo.ps. 
  736.  
  737.     Or if you would rather construct the bounding box by hand, use 
  738.     Ghostview, which has a continuous readout of the mouse cursor in 
  739.     the default user coordinate system. You simply place the mouse in 
  740.     the corners of the figure and read off the coordinates. 
  741.  
  742. ------------------------------
  743.  
  744. Subject: 10 About The Comp.Lang.PostScript FAQ 
  745.  
  746.  
  747. ------------------------------
  748.  
  749. Subject: 10.1 The PostScript FAQ: What is it? 
  750.  
  751.     The PostScript FAQ is a set of answers to frequently asked 
  752.     questions (FAQs) that have appeared on the Usenet newsgroup 
  753.     comp.lang.postscript. It is broken into many useful sections. 
  754.  
  755.     There is a companion file which is not posted to USENET called 
  756.     ``Exactly What Does a Transformation Matrix Do?''. You can get it 
  757.     from wilma.cs.brown.edu:pub/comp.lang.postscript/transform.tex. 
  758.  
  759.     I need help writing and revising answers for common questions 
  760.     relating to PostScript. Almost all of the information in the 
  761.     documents has been written by kind volunteers. The answers will be 
  762.     published in either or both documents. A very long answer in the 
  763.     Usenet Guide may be summarized, referred to briefly, or not 
  764.     mentioned at all in the FAQ. 
  765.  
  766.  
  767. ------------------------------
  768.  
  769. Subject: 10.2 How to get the FAQ files 
  770.  
  771.     The FAQ is available by anonymous ftp to 
  772.     wilma.cs.brown.edu:pub/comp.lang.postscript/ You can get it 
  773.     formatted in plain text ASCII, LaTeX, or PostScript. 
  774.  
  775.     I would be happy to email a copy of the FAQ in any format to you if 
  776.     you do not have FTP. 
  777.  
  778.  
  779. ------------------------------
  780.  
  781. Subject: 10.3 How to write a FAQ answer 
  782.  
  783.     I greatly appreciate your time and effort to help improve the 
  784.     quality of the FAQ. Thank you for being willing to contribute! 
  785.  
  786.  
  787.     * Please check to see if the topic is already in an FAQ. Perhaps 
  788.       you really mean to submit a revision to an existing section. 
  789.  
  790.     * Start with a clear statement about what problem you are solving. 
  791.  
  792.     * Write for novice users, in ``tutorial format'', even if the 
  793.       answer is meant for experienced programmers. 
  794.  
  795.     * Be specific when you make references. 
  796.  
  797.     * Be complete, and take the time to look over your draft and 
  798.       revise. 
  799.  
  800.     * Answers should not be too wordy, unless you intend to write a 
  801.       long answer for the Usenet Guide and have a shorter summary or a 
  802.       pointer to the description placed in the FAQ. If you want to 
  803.       write the summary yourself, thanks! 
  804.  
  805.     * Obviously, I cannot accept copyrighted material without 
  806.       permission. Don't write the FAQ by paraphrasing from a 
  807.       copyrighted book! 
  808.  
  809.  
  810. ------------------------------
  811.  
  812. Subject: 10.4 The FAQ can contain LaTeX and PostScript inserts 
  813.  
  814.     The FAQ is actually written with LaTeX, so feel free to submit with 
  815.     that text formatting language. There is a PostScript version of the 
  816.     FAQ also, so feel free to send along PostScript pictures to 
  817.     include. 
  818.  
  819.  
  820. ------------------------------
  821.  
  822. Subject: 10.5 Revising the FAQ 
  823.  
  824.     Suggestions and comments are welcomed. My favorite way of receiving 
  825.     a change suggestion is if you make a copy of the FAQ, edit the 
  826.     copy, and mail me the modification, or a context diff (include the 
  827.     version number). 
  828.  
  829.  
  830. ------------------------------
  831.  
  832. Subject: 10.6 How to submit new information 
  833.  
  834.     If you know something that you think is worthwhile to be put in a 
  835.     FAQ, definitely send it to me! 
  836.  
  837.     Don't hold back if your information is very specific. If there's 
  838.     too much information to post I will archive it at an ftp site and 
  839.     place a pointer to it in the FAQ. 
  840.  
  841.  
  842. ------------------------------
  843.  
  844. Subject: 10.7 How to add a program description to the FAQ index 
  845.  
  846.     If the program is original, please send it to me, or tell me where 
  847.     I can get it. Please put your name and email address at the top of 
  848.     each file. Your program will be doubly useful if you clean up the 
  849.     program so that other people can use it as an example to learn. 
  850.  
  851.     If the program was written by someone else, please send me just the 
  852.     title, description, and where to get it. I may already have it. 
  853.  
  854.     For programs the FAQ needs to know: 
  855.  
  856.  
  857.     * What is the name of the program? 
  858.  
  859.     * What does it claim to do, and does it do it well? Is it worth 
  860.       using? 
  861.  
  862.     * Where is it available? What ftp sites can I get it from? 
  863.  
  864.     * How much does it cost? Is it free? 
  865.  
  866.     * What kinds of computers does it run on? 
  867.  
  868.     * Who is the author and does the author give an email address? 
  869.  
  870.     * Does it handle PostScript 2? 
  871.  
  872.     * What packages does it rely on? 
  873.  
  874.     If the program is a PostScript interpreter, then the FAQ also needs 
  875.     to know: 
  876.  
  877.  
  878.     * Does it let you go backwards one page? 
  879.  
  880.     * Does it display the number of pages in the document? 
  881.  
  882.     * Does it let you print PostScript to a non-PostScript printer? 
  883.  
  884.     * What formats can it convert to? 
  885.  
  886.  
  887. ------------------------------
  888.  
  889. Subject: 10.8 How to add a book description to the FAQ 
  890.  
  891.     For books the FAQ needs to know: 
  892.  
  893.  
  894.     * What is the name of the book or document? 
  895.  
  896.     * What does it claim to do, and does it do it well? Is it worth 
  897.       using? 
  898.  
  899.     * Can I get it on-line? 
  900.  
  901.     * Who wrote it? Does the author give an email address? 
  902.  
  903.     * Who is the publisher, and what is the copyright date? 
  904.  
  905.     * Does the publisher list an address and phone number or fax 
  906.       number? 
  907.  
  908.     * What is the ISBN number of the book? 
  909.  
  910.     * What is the library call number of the book? 
  911.  
  912.     * How much does the book cost? 
  913.  
  914.     * Does it cover PostScript 2? 
  915.  
  916.     * Are coding examples from the book available by email or anonymous 
  917.       ftp? 
  918.  
  919.     * Do the authors sell the coding examples on a diskette? 
  920.  
  921.  
  922. ------------------------------
  923.  
  924. Subject: 10.9 Questions that need answers 
  925.  
  926.  
  927.  
  928.    1. Where are ftp sites that have PostScript freeware? 
  929.  
  930.  
  931.    2. What vendors sell fonts for PostScript printers? Where are the 
  932.       free ftp sites for them? 
  933.  
  934.  
  935.    3. Are there any free encapsulated PostScript converters? 
  936.  
  937.  
  938.    4. What is the charter for comp.lang.postscript? 
  939.  
  940.  
  941.    5. What questions should the FAQ have? 
  942.  
  943.  
  944.    6. What book information is wrong or missing in the FAQ? 
  945.  
  946.  
  947.    7. What program information is wrong or missing in the FAQ? 
  948.  
  949.  
  950.    8. What ftp site have good examples of PostScript code? 
  951.  
  952.